package com.design.singleton;

/**
 * 双重锁校验模式（线程安全）
 * @author ytj
 * @date 2024/11/27 15:39
 */
public class Singleton5 {
    private volatile static Singleton5 singleton5;

    private Singleton5(){}

    public static Singleton5 getSingleton5(){
        if(singleton5!=null){
            return singleton5;
        }
        synchronized (Singleton5.class){
            if(singleton5==null){
                singleton5=new Singleton5();
            }
        }
        return singleton5;
    }
}
